package presenter.code.entity;

public class CodeEntity {
    private final String code;
    private final String time;
    private final boolean timeOver;
    private final String stamp;
    private final boolean stampOver;

    public CodeEntity(String code, String time, boolean timeOver, String stamp, boolean stampOver) {
        this.code = code;
        this.time = time;
        this.timeOver = timeOver;
        this.stamp = stamp;
        this.stampOver = stampOver;
    }

    public String code() {
        return code;
    }

    public String time() {
        String fixedTime = timeOver ? String.format("超时%s", time) : time;
        return stampOver ? String.format("【%s】", fixedTime) : fixedTime;
    }

    public boolean timeOver() {
        return timeOver;
    }

    public String stamp() {
        return stampOver ? String.format("【%s】", stamp) : stamp;
    }
}
